﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HCQ2_Model.APPModel.ParamModel;
using System.Globalization;
using System.ComponentModel.DataAnnotations;

namespace HCQ2_Model
{
    public class FavoritesClassModel: BaseAPI
    {
        public int fc_id { get; set; }
        public int user_id { get; set; }
        [Required(ErrorMessage = "class_id：编辑id必填")]
        public int class_id { get; set; }
        /// <summary>
        ///  1：关注
        ///  0：取消关注
        /// </summary>
        [Required(ErrorMessage = "mark：删除标记必填")]
        public int mark { get; set; } = 1;
        public string create_date { get; set; }
        public T_VRFocusClass ToEntity()
        {
            return new T_VRFocusClass
            {
                fc_id = this.fc_id,
                user_id = this.user_id,
                class_id = this.class_id,
                mark = (this.mark > 0) ? true : false,
                create_date = (this.create_date != null) ? DateTime.ParseExact(this.create_date, "yyyyMMddHHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None) : DateTime.Now
            };
        }
    }
    public partial class T_VRFocusClass
    {
        public FavoritesClassModel ToPOCO()
        {
            return new FavoritesClassModel
            {
                fc_id = this.fc_id,
                user_id = this.user_id,
                class_id = this.class_id,
                mark = (this.mark)?1:0,
                create_date = this.create_date.ToString("yyyy-MM-dd HH:mm")
            };
        }
    }
}
